package com.example.microservicesimpleprovideruser.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.example.microservicesimpleprovideruser.dao.UserRepository;
import com.example.microservicesimpleprovideruser.model.User;

/**
 * @author wzg
 * @date 2021/10/16 19:48
 */
@RestController
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
public class UserController {
    private final UserRepository userRepository;

    @GetMapping("/{id}")
    public User findById(@PathVariable Long id){
        return userRepository.getById(id);
    }
}
